<?php

namespace api\modules\app\controllers;

use api\components\BaseController;
use api\modules\app\services\DeployService;

class QrcodeDeployController extends BaseController
{
    public $modelClass = 'api\\modules\\app\\models\\QrcodeDeploy';

    public function actions()
    {
        $actions = parent::actions();
        unset($actions['create'], $actions['index']);

        return $actions;
    }

    public function actionCreate()
    {
        $params = $this->getParams();
        $user = $this->getUser();

        return (new DeployService())->create($params, $user);
    }

    public function actionIndex()
    {
        $params = $this->getQuery();

        return (new DeployService())->search($params);
    }

    public function actionExport()
    {
        $params = $this->getQuery();

        return (new DeployService())->export($params);
    }

    public function actionUnitCount()
    {
        $params = $this->getParams();

        return  [
            'count' => (new DeployService())->countUnit($params)
        ];
    }
}
